package com.foreknow.demo5;

import java.util.Scanner;

public class TestEmployee {

    //public Employee a() {
    //    return new Employee();//匿名对象的写法
    //}

    public static void main(String[] args) {
        Employee employee1 = new Employee();
        employee1.setStaffid("s10001");
        String id = employee1.getStaffid();
        employee1.setName("tom");
        String name = employee1.getName();
        employee1.setDept("clark");
        String dept = employee1.getDept();
        employee1.setSalary(5678);
        double salary = employee1.getSalary();
        System.out.println(id+"---"+name+"---"+dept+"---"+salary);

        //new Employee().setName("lily"); //匿名对象

        Employee employee2 = new Employee();
        Scanner input = new Scanner(System.in);
        System.out.println("请输入员工编号");
        employee2.setStaffid(input.next());
        System.out.println("请输入员工姓名");
        employee2.setName(input.next());
        System.out.println("请输入员工部门");
        employee2.setDept(input.next());
        System.out.println("请输入员工工资");
        employee2.setSalary(input.nextDouble());

        EmployeeManager emp1 = new EmployeeManager();
        emp1.add(employee1);
        emp1.add(employee2);

        Employee[] a = new Employee[2];
        emp1.selectAll();
        for (int i = 0;i<a.length;i++) {
            System.out.println("姓名：" + a[i]);
        }

        System.out.println("请输入要查询的员工编号");
        String selectid = input.next();
        Employee emp0 = emp1.select(selectid);
        System.out.println("查询到员工的姓名为" + emp0.getName());

    }
}








